Tablas

Introducción

Tables are documents which contain alphanumeric information. Tables are made up of rows or records (which represent each of the elements in the data base) and columns or fields (which define the different attributes of each element).

tablas/tablas-en.img/tablaExlicada_en.png

Row or record: Used to represent the different elements in the table.

Column or field: The types of attributes which define each element.

Cell: A cell is the intersection of a record and a field. A cell is the minimum working element and may contain information.

Record information: This provides information about the total number of elements (records) contained in the table.

All the vector information layers have their own “Table of attributes”. Each graphic element in a particular layer has its corresponding record in the “Table of attributes”.

To select elements in the table, left click on them. Use the “Control” and “Shift” (CAPS) keys to select more than one record.


Cargar una tabla

Cargar una tabla

You can load a table in gvSIG in two ways:


Cargar una tabla desde el gestor de proyectos

cargar-una-tabla-1/cargar-tabla-en.img/gestorProyectosTabla_en.png

Select “Tables” as the document type from the “Project manager” and click on “New”. A dialogue box will open in which you can add the table.

cargar-una-tabla-1/cargar-tabla-en.img/nuevaTablaVentana_en.png

When you click on the “Add” button, a browser window will open.

cargar-una-tabla-1/cargar-tabla-en.img/exploradorDeArchivos_es.png

Specify the type of file you wish to load in gvSIG in “Files of Type”. When you have located the file that contains the table, select it so that it is added to the “File name” text box and click on “Open”. You will automatically be returned to the "Add table" dialogue. If you wish to add more than one table, click on "Add" again and repeat the process. When you have finished, click on “Ok”. The table will then be displayed. It will also appear in the “Project manager” text box.

cargar-una-tabla-1/cargar-tabla-en.img/tablaAnyadida_en.png

Cargar una tabla desde la vista

Click on the “See table of attributes” button from the display window of a view with at least one active layer, i.e. a layer that is selected in the ToC,

cargar-una-tabla-1/cargar-tabla-en.img/botonAnyadirTabla_es.png

or go to the "Layer" menu and then select the "See table of attributes" option.

cargar-una-tabla-1/cargar-tabla-en.img/menuTablaAtributos_en.png

The table will automatically be added to the project.

cargar-una-tabla-1/cargar-tabla-en.img/tablaCargada_en.png

If you minimise the view, go back to the “Project manager” and select “Tables” as the document type, you will see that the table displayed in the view appears in the text box.


Propiedades de la tabla

You can access “Table properties” from the “Project manager” window.

propiedades-de-las-tablas/propiedades-de-las-tablas-en.img/propiedadesTabla_en.png

You can use this window to:

When you have input the changes, click on “Ok” and they will be saved.


Herramientas asociadas a las tablas

Introducción

When a table has been loaded, either from the “Project manager” or from the view, the tools associated with the table will appear in the tool bar.

herramientas-asociadas-a-las-tablas/introduccion-en.img-1/botonesTablas_es.png

A new menu, called “Table”, will also be activated in the tool bar. This can also be used to access the different tools.

herramientas-asociadas-a-las-tablas/introduccion-en.img-1/menuBarraDeHerramientas-en.png

Cálculo de Estadísticas de un campo

You can access this option by clicking on the following button

estadiasticas-en.img/botonEstadisticas_es.png

or by going to the “Table” menu and then to “Statistics”.

The “Statistics” tool allows you to obtain the most common statistical values.

N.B.: Remember that the tool will not be activated until you select a numerical field.

If you wish to obtain field statistics, select the field (left click on the field heading), then click on the “Statistics” tool.

You can only obtain statistics from a series of records, firstly, select the field the values are located in, then select the desired records, and click on the “Statistics” tool.

estadiasticas-en.img/estadisticas_en.png

Realizar consultas, filtros en una tabla

You can access this tool by clicking on the “Filter” button in the tool bar

tablas/herramientas-asociadas-a-las-tablas/filtros/filtros-en.img/botonFiltros_es.png

or by going to the “Table” menu and then to “Filter”. The “Filter” tool works in much the same way as in the “Views” section.

gvSIG allows selections to be made using filters. Selection using filters allows you to define exactly what you want to select, including several attributes, operators and calculations.

Requests can be made using logical operators, such as “equals” “more than” “different from”, etc.

If you press the “Filter” button in the tool bar, a dialogue window will appear to define your request.

herramientas-asociadas-a-las-tablas/filtros/filtros-en.img/ventanaDeFiltro_en.png

Fields: Double click on the field you wish to add to your request from the “Fields” list in the layer.

Logical operators: These allow you to insert a logical expression into your query by clicking on them.

Values: This shows a list with the different values the selected field has. If you wish to add a value to the request, double click on it.

Request: This is the window which represents the request to be made. You can write here directly.

Selection buttons: These buttons make the request using:

N.B.: In a gvSIG view, when you activate a layer by selecting it in the ToC, the filter tool will also be activated in the tool bar, even though no table has been loaded. This allows you to work with the table associated with the selected layer. The "Table" menu will also be added in the menu bar. This provides another way to access the filter tool when it drops down.


Ordenar un campo de forma ascendente

You can access this tool by clicking on the following tool bar button

herramientas-asociadas-a-las-tablas/orden-ascendente/orden-ascendente-en.img/botonOrdenAscendente_es.png

or by going to the “Table” menu and then to “Ascending order”.

The “Ascending order” tool allows you to order the table records.


Ordenar un campo de forma descendente

You can access this tool by clicking on the following tool bar button

herramientas-asociadas-a-las-tablas/orden-descendente/orden-descendente-en.img/botonOrdenDescendente_es.png

or by going to the “Table” menu and then to “Descending order”. The “Descending order” tool allows you to order the table records. It orders the values from the highest to the lowest in a numerical field. It orders the records in alphabetical order, starting from “Z” in a text field.


Unir tablas

The “Join” tool allows two tables to be joined via a common field. You can also access this tool by clicking on the following button

herramientas-asociadas-a-las-tablas/unir/unir-en.img/botonUnir_es.png

or by going to the “Table” menu and then to “Join”. To join the two tables, carry out the following steps: Firstly, specify the source table the join is to be made from.

herramientas-asociadas-a-las-tablas/enlace/enlace-en.img/seleccionTablaJoin_en.png

Then specify the field to be used for the join.

herramientas-asociadas-a-las-tablas/enlace/enlace-en.img/seleccionCampoJoin1_es.png

Then indicate the table you wish to join to the first one.

herramientas-asociadas-a-las-tablas/enlace/enlace-en.img/seleccionTablaJoin2_en.png

Finally, indicate the field in the second table which is common to the first one.

herramientas-asociadas-a-las-tablas/enlace/enlace-en.img/seleccionCampoJoin2_en.png

If you open the data source table, you will see that the fields of the destination table have been joined. The name of the field added to the table is identified by the word “Join_(Field name)”


Enlazar campos de una tabla

You can access this tool by clicking on the following button in the tool bar

herramientas-asociadas-a-las-tablas/enlace/enlace-en.img/botonEnlace_es.png

or by going to the “Table” menu and then to “Link”. The “Link” tool allows two tables to be linked via a common field, so that any changes that take place in one table will also be shown in the other one.

Firstly, specify the source table the link is to be made from.

herramientas-asociadas-a-las-tablas/unir/unir-en.img/seleccionTablaJoin_en.png

Then specify the field to be used for the link.

herramientas-asociadas-a-las-tablas/unir/unir-en.img/seleccionCampoJoin1_es.png

Then indicate the table you wish to link to the first one.

herramientas-asociadas-a-las-tablas/unir/unir-en.img/seleccionTablaJoin2_en.png

Finally, indicate the field in the second table which is common to the first one.

herramientas-asociadas-a-las-tablas/unir/unir.png/seleccionCampoJoin2_es.png

Llevar una selección de registros arriba de la tabla

This tool allows the records selected in the table to be moved to the top of the table. You can access this tool by clicking on the following button in the tool bar

herramientas-asociadas-a-las-tablas/filtros/filtros.img/botonSelectionUp_es.png

or by going to the “Table” menu and then to “Move selection to top”. The following table shows an example in which two records have been selected to move to the top of the table.

tablas/herramientas-asociadas-a-las-tablas/filtros/filtros.img/tablaSelectionUpAntes_es.png

If you click on the button, the table will change the position of the selected records.

tablas/herramientas-asociadas-a-las-tablas/filtros/filtros.img/tablaSelectionUpDespues_es.png

Cargar una tabla desde un archivo CSV

From version 0.5 onwards, gvSIG can read information contained in a plain text file, whose fields are separated by a semi-colon.

cargar-una-tabla-a-partir-de-un-fichero-cvs-en.img/tablaTextoPlano_es.png

To carry out this operation, go firstly to the “Project manager”. Select “Tables” and then click on “New”. A search dialogue box will open. Click on “Add” and the file browser will appear in a new window (select “csv string” in “Type of file” to show the csv files).

cargar-una-tabla-a-partir-de-un-fichero-cvs-en.img/exploradorDeArchivos_es.png

When the .csv file has been selected, click on “Open”.

If you click on “Ok”, the data of the table you have added will be shown.

cargar-una-tabla-a-partir-de-un-fichero-cvs-en.img/tablaAnyadidaCSV_en.png

Añadir una tabla a partir de un origen de datos JDBC

The contents of a data base table can be imported to gvSIG using data base managers (PostgreSQL, MySQL, GBMS-HSQLDB, ODBC). gvSIG processes the information obtained just like any other table.

Note: Oracle drivers installation is required for access to Oracle Spatial databases of the geoBD extension. Please follow the steps bellow: Go to Oracle Database 10g Release 2 (10.2.0.3) drivers.

Accept the license terms. In the next page, download the file ojdbc14.jar (1,545,954 bytes) - classes for use with JDK 1.4 and 1.5. (Registration required)

Move this file to the next folder:

Move the file to the:

bin\gvSIG\extensiones\com.iver.cit.gvsig\lib 

folder, that is in the directory where gvSIG is installed.

Move the file to the:

bin/gvSIG/extensiones/com.iver.cit.gvsig/lib folder

, that is in the directory where gvSIG is installed.

To load a table with the information obtained from a JDBC data origin you must:

Firstly, go to the "Project manager" and select "Tables". Then click on "New". Select the “Data base” tab in the window that opens (“New table”) and configure the data base server connection parameters:

cargar-una-tabla-a-partir-de-un-origen-de-datos-jdbc-en.img/PestanyabasesDedatos_en.png

If the information entered is correct, a new table will be created in gvSIG with the information contained in the original JDBC table.


Calculadora de campos

Introducción

gvSIG’s field calculator allows you to perform different types of calculations on the fields of a table (for example calculate areas, perimeters, convert the data in a field from degrees to radians, etc).


Acceso a la calculadora de campos en gvSIG

To access the field calculator, you must first start an editing session in gvSIG. If you wish to activate the edition of a layer loaded in a view, go to the layer’s contextual menu and select “Start edition”.

calculadora-de-campos/calculadora-de-campos-en.img/menuComenzarEdicion_es.png

If you wish to edit a recently-loaded table, go to the “Table” menu and select “Start edition”.

calculadora-de-campos/calculadora-de-campos-en.img/tablaComenzarEdicion_es.png

If you decide to use the field calculator on a “New layer” (for example New shp) which you are going to create (remember that to access this option you must go to the “View” menu and select the “New layer” option), the layer will automatically appear in editing mode when inserted in the view.

calculadora-de-campos/calculadora-de-campos-en.img/menuNuevacapa_es.png

Once you have started an editing session, activate the table of attributes on which the operations are going to be performed and select one of the fields (by clicking on the field heading). The following button will then be activated in the tool bar:

calculadora-de-campos/calculadora-de-campos-en.img/botonCalculadoraCampos_es.png

This will allow you to access the field calculator.

NB. The first time you open the field calculator in a new gvSIG session, a warning window appears to inform you that the calculator is “Loading operators”. Once this process has finished, the window which allows you to perform operations with the various fields appears.


Descripción de la calculadora de campos

Introducción
tablas/calculadora-de-campos/calculadora-de-campos-en.img/ventanaCalculadoraCampos_es.png

The field calculator window has three different sections.


Información

The Information section provides information about the type of field and the commands selected in the “General” tab.

The following information can be found in this section:

tablas/calculadora-de-campos/calculadora-de-campos-en.img/informacionIsNumber_es.png

Example: In this case the command we wish to use is “log”, which allows us to calculate the logarithm of a field with a numerical value.

calculadora-de-campos-en.img/informacionLogaritmo_es.png

The “log (Parameter)” operator indicates that, for example, in order to obtain the logarithm of a field which contains the area data of a plot shp, the word “Parameter” must be replaced by the field we wish to obtain the logarithm of. As a result, the expression will be as follows: log([AREA])

calculadora-de-campos-en.img/expresionColumnaLogaritmo_es.png

NB. If a table field is selected in the “Field” section of the field calculator, the information window indicates what type of data it is.

NB. In order to input parameters into the “Expression” text box, either double click on the name of the field from the list of fields in the General tab or type in the name of the field, in which case the String expressions input must be placed in inverted commas.

calculadora-de-campos-en.img/InformacionCampoArea_es.png

System Message: WARNING/2 (<string>, line 44)

Bullet list ends without a blank line; unexpected unindent.

Numerical Value = The result must be String, Double or integer type field data.

NB. If a String field type has been selected, it should be noted that this field type uses string values. If we add two String fields to another String field, the final result is a string and not the result of the operation (for example: 2+2 = 22, not 4).

Boolean Value = A Boolean value returns a true/false answer to a question. If the result of the question is in a numerical field, it would therefore be either “1/0” depending on whether the reply was true or false. Let us look at an example:

We wish to know if there are records in a field which are the same as those in another field. The command which allows us to find this out “==”

calculadora-de-campos-en.img/informacionValorBoleano_es.png

If we type the following sentence: [integer] == [double] (double and integer being the names of two fields, each with numerical values), the response according to the type of target field (Boolean or String) can be seen in the image below:

calculadora-de-campos-en.img/tablaConIntDouBooStr_es.png

NB. If a new layer is created in a gvSIG view (View menu / New layer), the wizard for this action allows you to specify the “Type of field” on which calculations are going to be performed.

calculadora-de-campos-en.img/NuevaCapaAnyadirCampos_es.png

If you are working with a layer and wish to know the field type, simply start a layer editing session, go to the “Table” menu and select “Manage fields”.

tablas/calculadora-de-campos/calculadora-de-campos-en.img/menuModificarEstructuraTabla_es.png

This opens a window called the “Field manager”, which allows the fields of a table to be created, renamed or deleted. It can also be used to confirm the field type.

tablas/calculadora-de-campos/calculadora-de-campos-en.img/editorCampos_es.png

Pestaña General/Avanzada
tablas/calculadora-de-campos/calculadora-de-campos-en.img/pestanyaAvanzada_es.png

Once the file has been selected, click on the “Evaluate” button to find out whether the expression is correct or not.

NB. The expressions must be written in Python programming language.


Apartado "Expresión"

The name of the field the results of the calculations of the expressions entered in the text box appear in is next to the “Column” text.

NB. The expressions are only calculated on the records selected in the table (if no records have been selected, the calculation is performed on all the records in the selected field).


Ejemplo de introducción: "Calculadora de campos"

“Field calculator” Let us look at a simple example to explain how the field calculator works.

In order to work out the area of a series of plots in a layer we have created:

First, open a gvSIG view and load an orthophoto which will be used as a base to determine the location of the plots. Next, select the tool in order to create a new shp file (View/New layer/SHP).

Select a “Polygon” type layer, click on the “Next” option and then create a “Double” type field called “Area”, leaving the default value at 20.

calculadora-de-campos/calculadora-de-campos-en.img/NuevaCapaAnyadirCampos_es.png

Draw four plots on the orthophoto using the “Insert polyline” tool selected from the tool bar. The image below shows that a record for each of the plots has been created in the table.

tablas/calculadora-de-campos/calculadora-de-campos-en.img/parcelasDigitalizadas_es.png

Select the field from the table and activate the field calculator.

tablas/calculadora-de-campos/calculadora-de-campos-en.img/botonCalculadoraCampos_es.png
calculadora-de-campos-en.img/ventanaCalculadoraCampos_es.png

The following information appears in the “General” tab:

calculadora-de-campos-en.img/CampoTipoComandosCalculadoraCampos_es.png

“Field”. This contains the various different fields which comprise the table being worked on.

“Type” of field selected. Access to different commands depends on the type of field.

“Commands” which can be used in the calculations.

The “Information” section shows that:

If the “area” command has been selected in the “General” tab, a brief description will be displayed in the information window.

calculadora-de-campos-en.img/informacionValorBoleano_es.png

If the “area” command has been selected in the “General” tab, the information window returns a message with information on the field type (remember that when designing the “area” shape, a Double type numeric field was created in which the area will be calculated).

calculadora-de-campos-en.img/informacionCalculadoraCampos_es.png

The “Expression" area displays the name of the column on which the calculation is being performed and a text box for the calculation sentence to be used.

calculadora-de-campos-en.img/informacionAreaCalculadoraCampos_es.png

In this case, the sentence included in the expression section is simple (no parameters are required as they are in other expressions which shall be explained later on).

To sum up and conclude this example, once the “area” command has been selected, click on “Ok” and the field created in the table will automatically be filled with the area values of each of the polygons drawn.

calculadora-de-campos-en.img/tablaResultadosArea_es.png


-----------------------------------
  1. Se ha producido un error "Unauthorized", probablemente la imagen no esta publicada. En el documento Introducción
  2. Se ha producido un error "Unauthorized", probablemente la imagen no esta publicada. En el documento Enlazar campos de una tabla

Cached time 11/22/13 05:40:35 Clear cache and reload